{include file="common/header"/}
<div class="lemo-container">
    <div class="lemo-main">
        <fieldset class="layui-elem-field layui-field-title">
            <legend>{:lang('admin')}{:lang('list')}</legend>

            <blockquote class="layui-elem-quote">
                <div class="lemo-table">
                    <div class="layui-inline">
                        <input type="text" name="keys" id="keys" lay-verify="required" placeholder="请输入"
                               autocomplete="off" class="layui-input">

                    </div>
                    <button class="layui-btn data-add-btn layui-btn-sm" lay-submit="" lay-filter="search" id="search">
                        搜索
                    </button>
                    <a data-href='{:url("adminAdd")}' href="javascript:;"
                       class="layui-btn layui-btn-sm layui-btn-warm add">{:lang('add')}用户</a>

                </div>

            </blockquote>

        </fieldset>

        <table class="layui-table" id="list" lay-filter="list"></table>
    </div>
</div>
{include file="common/footer"/}

<script type="text/html" id="action">
    <a data-href="{:url('aedit')}?id={{d.id}}" class="layui-btn layui-btn-xs" lay-event="edit">{:lang('edit')}</a>
    {{# if(d.id==1){ }}
    <a href="#" class="layui-btn layui-btn-xs layui-btn-disabled">{:lang('del')}</a>
    {{# }else{  }}
    <a data-href="{:url('adminDel')}" class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">{:lang('del')}</a>
    {{# } }}
</script>
<script type="text/html" id="status">
    {{# if(d.id==1){ }}
    <input data-href="{:url('adminState')}" type="checkbox" disabled name="status" value="{{d.id}}" lay-skin="switch"
           lay-text="开启|关闭" lay-filter="status" checked>
    {{# }else{  }}
    <input data-href="{:url('adminState')}" type="checkbox" name="status" value="{{d.id}}" lay-skin="switch"
           lay-text="开启|关闭" lay-filter="status" {{ d.status== 1 ? 'checked' : '' }}>
    {{# } }}
</script>
<script>
    var tableIn;
    layui.config({
        base: "/static/admin/js/",
        version: true
    }).extend({
        Admin: 'Admin'
    }).use(['element', 'layer', 'Admin'], function () {
        var $ = layui.jquery,
            form = layui.form,
            table = layui.table;

        // tableIn = table.render({
        //     elem: '#list',
        //     url: '{:url("adminList")}',
        //     method: 'post',
        //     title: '数据表',
        //     toolbar: '#toolbar', //开启头部工具栏，并为其绑定左侧模板
        //     defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
        //         title: '提示'
        //         ,layEvent: 'LAYTABLE_TIPS'
        //         ,icon: 'layui-icon-tips' }],
        //     cols: [[
        //         {checkbox: true, fixed: true},
        //         {field: 'id', title: 'ID', width: 80, type: 'numbers', fixed: true, sort: true},
        //         {field: 'title', title: '标题', width: 200},
        //         {field: 'desc', title: '描述', width: 400},
        //         {field: 'create_time', title: '创建时间', width: 180,templet:'#create_time'},
        //         {field: 'update_time', title: '更新时间', width: 180,templet:'#update_time'},
        //
        //         {title:'操作',width:150, toolbar: '#action',align:"center"},
        //
        //     ]],
        //     limits: [10, 15, 20, 25, 50, 100],
        //     limit: 15,
        //     page: true
        // });

        tableIn = table.render({
            elem: '#list',
            url: '{:url("adminList")}',
            method: 'post',
            title: '{:lang("admin")}{:lang("list")}',
            cols: [[
                {field: 'id', title: 'ID', width: 60, fixed: true, type: 'numbers',}
                , {field: 'username', title: '用户名', width: 180}
                , {field: 'title', title: '{:lang("adminGroup")}', width: 100}
                , {field: 'email', title: '{:lang("email")}', width: 200}
                , {field: 'mobile', title: '{:lang("mobile")}', width: 150}
                , {field: 'ip', title: '{:lang("ip")}', width: 150, hide: true}
                , {field: 'status', title: '{:lang("status")}', width: 150, toolbar: '#status'}
                , {title: '操作', width: 150, toolbar: '#action', align: "center"}
            ]],
            limits: [10, 15, 20, 25, 50, 100],
            limit: 15,
            page: true
        });

    });
</script>
